home *** CD-ROM | disk | FTP | other *** search
- ; Date: 07-31-92 22:35
- ; From: Larry Teghtmeyer
- ;----------------------------------------------------------------------
- ;Ok, so I set down last night and came up with a couple of routines and
- ;thought I would try them out and see if I could get them into my
- ;computer as good as they are in my head and here is what I came up with.
- ;Maybe you can use the information, but I know you can see it can be done
- ;with A86. The first program is to be typed in or transfered to a text
- ;file. I could suggest test.asm.
-
- ;CUT HERE-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-
-
-
- PUBLIC a86test
-
- data segment para public 'data'
- message1 db 'This text stored in the assembly data area'
- message1l equ $-message1
- row db 0
- col db 0
- attr db 0
- rowlen dw 160
-
- code segment para public 'code'
- a86test:push bp ;got to save it for qb later
- mov bp,sp ;now we can access the passed parameters
- push ds,es ;we are now saving DS and ES
- mov ax,seg message1
- mov es,ax
- mov si,[bp+6] ;lets get the attr calculated in qb
- mov ax,[si]
- mov es:attr,al
- mov si,[bp+8] ;get the integer val of col
- mov ax,[si]
- mov es:col,al ;store val of col in row
- mov si,[bp+10] ;now get row
- mov ax,[si]
- mov es:row,al
- mov ax,[bp+12] ;now we are going for the string passed
- from qb
- mov bp,ax ;store the string location in bp
- mov ax,[bp] ;get the string len
- mov cx,ax ;put the string len into cx
- mov ax,[bp+2]
- mov bp,ax
- mov bh,0
- mov bl,es:attr
- mov dh,es:row ;remember this is 0 based instead of 1
- based
- mov dl,es:col ;as in qb
- mov es,ds ;a86 takes care of register to register transfer
- mov al,0
- mov ah,013 ;the 0 in front of 13 makes this a hex
- number
- int 010 ;bios call to print string
-
- mov cx,message1l ;this routine will be a direct screen write
- mov es,0b800 ;for b&w use 0b000
- mov ax,seg message1 ;get the segment address of our message
- mov ds,ax ;store it in ds
- lea si,message1 ;get the location of our message into si
- add row,2 ;we need to print the second string at a different
- location
- mov al,row
- cbw ;make it into a word
- mul rowlen
- add al,col
- if c add ah,1
- add al,col ;this calculates the screen pos to print to
- if c add ah,1
- mov di,ax ;ES:DI = destination;DS:SI = sourse
- mov ah,attr
- m1:lodsb ;loads al with a byte from string
- stosw ; stores the word in screen memory
- loop m1 ;do this cx times
- pop es,ds,bp ;one call to pop all trashed registers
- retf 4*2 ;far ret for basic and clean up stack
-
- ;CUT HERE-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-
- ;Notice there are no assumes, no memory management, no endp,no ends, no
- ;other extranious BS. Just code. You don't have to even declare the
- ;public names, but I do just so no other lables become public and can be
- ;used by other procedures.
- ; Now you have the text file "test.asm". Just tpye in from the DOS
- ;command line: A86 +o test.asm
- ;In an eyeblink, you wil have test.obj to play around with. Make a
- ;library and .qlb in the normal manner from DOS. (ie. lib test,
- ;test.obj;) and (link /q test,etc). I'm sorry, but *I* type in only what
- ;*I* need and then follow the prompts! (I can't remember all the systax
- ;I need. (Sheepish grin))
- ; Now that you have your new library, I have a small bit of qb code
- ;for you to test it out with:
-
- ;CUT HERE-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-
-
- DECLARE SUB a86test (a$, row%, col%, attr%)
- b$ = "This string stored in qb"
- row% = 5
- col% = 1
- attr% = 31 'BLUE backgroun,white foreground (or 16 * backgroung +
- 'foreground
- COLOR 7, 1: CLS
- CALL a86test(b$, row%, col%, attr%)
-
- CUT HERE-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-
-
- 'load this into qb with the quick library created above and run it. You
- 'may be *amaized* to see that it may even work! Let me know how it turns
- 'out for you ...
- 'Type you later.
- ' Larry Teghtmeyer
-